package com.ikas.ai.server.mock;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.ikas.ai.enums.redis.RedisKeyEnum;
import com.ikas.ai.server.module.AbstractBean;
import com.ikas.ai.server.module.morningpaper.model.dto.MorningPaperTimeTitleDto;
import com.ikas.ai.server.module.morningpaper.model.dto.MorningPaperVariablesDto;
import com.ikas.ai.server.module.morningpaper.render.MorningPaperVariablesRender;
import com.ikas.ai.server.module.morningpaper.service.MorningPaperHisService;
import com.ikas.ai.server.module.morningpaper.service.MorningPaperVariablesService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.junit4.SpringRunner;

import java.text.ParseException;
import java.time.Instant;
import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@RunWith(SpringRunner.class)
@SpringBootTest
@Slf4j
public class MockMorningPaper {

    @Autowired
    ApplicationContext applicationContext;

    @Test
    public void testRender(){
        MorningPaperVariablesRender bean = applicationContext.getBean(MorningPaperVariablesRender.class);
        log.info(bean.toString());
    }
    @Test
    public void getOneExist(){
        MorningPaperVariablesDto morningPaperVariablesDto = applicationContext.getBean(MorningPaperVariablesService.class).get();
        log.info(morningPaperVariablesDto.toString());
    }

    @Test
    public void testMap() {
        Map<String, Integer> mapA = new HashMap<>();
        System.out.println("Before methodB: " + mapA);

        methodB(mapA);

        System.out.println("After methodB: " + mapA);
    }

    public static void methodB(Map<String, Integer> map) {
        map.put("key", 42);
    }

    @Test
    public void testGetStartAndEndDate(){
        MorningPaperTimeTitleDto todayTimeTitle = applicationContext.getBean(MorningPaperHisService.class).getTodayTimeTitle();
        log.info(todayTimeTitle.toString());
    }

}
